function flushCode(object) {
    // document.getElementById("code").src = "/code?date=" + new Date();
    // object.src="/code?date=" + new Date();
    $(object).attr("src", "http://localhost:8088/code?date=" + new Date());
}

// var 全局
//     let 局部
// const 常量
function login() {
    let username = $("#username").val();
    let password = $("#password").val();
    let code = $("#code").val();
    let reg = /^[a-zA-Z]\w{5,15}$/;
    if (!reg.test(username)) {
        alert("你输入用户名的格式不正确!");
        return;
    }
    if (!reg.test(password)) {
        alert("你输入密码的格式不正确!");
        return;
    }
    let data = myAjax("/login", {username: username, password: password, code: code}, 'post');
    if (data != null) {
        if (data.count == 1) {
            $.cookie("username",username);
            window.location.href = "/back/manage.html";
        } else if (data.count == 0) {
            alert("你输入的用户名或者密码不正确");
        } else if (data.count == -1) {
            alert("你输入的验证码不正确");
        }
    }


}